<div draggable mat-dialog-title>
  <h6>{{title}}</h6>
</div>
<div mat-dialog-content>
  <form [formGroup]="formGroup" class="form-container" novalidate autocomplete="off">
    <mat-form-field>
      <span *ngIf="!isModify()" matPrefix>{{institution.ip}}</span>
      <input formControlName="username" [readonly]="isModify()" matInput placeholder="{{'username' | translate}}">
    </mat-form-field>
    <mat-form-field>
      <input formControlName="lastName" matInput placeholder="{{'name' | translate}}">
    </mat-form-field>
    <mat-form-field *ngIf="isAdd()">
      <input formControlName="password" type='password' matInput placeholder="{{'password' | translate}}">
    </mat-form-field>
    <mat-form-field *ngIf="showCares()">
      <mat-label>{{'cares' | translate}}</mat-label>
      <mat-select formControlName="cares" multiple>
        <mat-option>
          <ngx-mat-select-search
           placeholderLabel="{{'search' | translate}}"
           [formControl]="caresFilterCtrl">
            <mat-icon svgIcon="close" style="color: darkblue;" ngxMatSelectSearchClear>delete</mat-icon>
          </ngx-mat-select-search>
        </mat-option>
        <mat-option *ngFor="let care of filteredCares | async" [value]="care.id">{{care.personName + ' [' + care.rid + ']'}}</mat-option>
      </mat-select>
    </mat-form-field>
    <mat-form-field>
      <mat-select formControlName="role" placeholder="{{'role' | translate}}">
        <mat-option value="director">{{"director" | translate}}</mat-option>
        <mat-option value="doctor">{{"doctor" | translate}}</mat-option>
        <mat-option value="header">{{"header" | translate}}</mat-option>
        <mat-option value="nurse">{{"nurse" | translate}}</mat-option>
        <mat-option value="family">{{"family" | translate}}</mat-option>
      </mat-select>
    </mat-form-field>
  </form>
</div>
<div mat-dialog-actions>
  <div *ngIf="error" class="wdl-error">{{error | translate}}</div>
  <button mat-button (click)="dialogRef.close('Close')">{{"close" | translate}}</button>
  <button mat-button (click)="submit()" [disabled]="disableSubmit()">{{"submit" | translate}}</button>
</div>
